;(function () {
    let timer = {
        setTimeout: newFunc('setTimeout', 5, function setTimeout(callback, ...arg) {
            // debugger
            const timer_obj = timerFuncs.setTimeout(callback, ...arg);
            const timer_id = parseInt(Object.keys(mm.memory.timer_map).sort((a, b) => {
                return a - b;
            }).pop()) + 1;
            mm.memory.timer_map[timer_id] = timer_obj
            return timer_id;
        }),
        setInterval: newFunc('setInterval', 5, function setInterval(callback, ...arg) {
            // debugger
            const timer_obj = timerFuncs.setInterval(callback, ...arg);
            const timer_id = parseInt(Object.keys(mm.memory.timer_map).sort((a, b) => {
                return a - b;
            }).pop()) + 1;
            mm.memory.timer_map[timer_id] = timer_obj
            return timer_id;
        }),
        clearTimeout: newFunc('clearTimeout', 5, function clearTimeout(timer_id) {
            const timer_obj = mm.memory.timer_map[timer_id];
            return timerFuncs.clearTimeout(timer_obj)
        }),
        clearInterval: newFunc('clearInterval', 5, function clearInterval(timer_id) {
            const timer_obj = mm.memory.timer_map[timer_id];
            return timerFuncs.clearInterval(timer_obj)
        })
    };
    for (const key in timer) {
        if (Object.hasOwnProperty.call(timer, key)) {
            const timer_obj = timer[key];

            // mm.safefunction(timer_obj);

            Object.defineProperty(this, timer_obj.name, {
                value: timer_obj,
                configurable: true,
                enumerable: true,
                writable: true
            })
        }
    }
    ;

})();